<template>
  <button class="clear-btn">
    <span>
      <slot></slot>
    </span>
  </button>
</template>

<style lang="scss" scoped>
.clear-btn {
  display: flex;
  align-items: center;
  color: #000;
  background: none;
  border: none;
  padding: 5px 10px;
  position: relative;
  font-size: 14px;
  text-transform: uppercase;
  font-weight: 700;
  font-family: monospace;
  transition: linear 0.3s;
  margin: 10px;

  span {
    position: relative;
    z-index: 2;
  }
}

.clear-btn:hover {
  color: #fff;
}

.clear-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  transform: translateY(-50%) translateX(calc(100% + 4px));
  width: 30px;
  height: 30px;
  background-color: #dc143c;
  border-radius: 50px;
  transition: transform 0.25s 0.25s cubic-bezier(0, 0, 0.5, 2),
    width 0.25s cubic-bezier(0, 0, 0.5, 2);
  z-index: 1;
}

.clear-btn:hover::before {
  width: 100%;
  transform: translateY(-50%) translateX(-18px);
  transition: transform 0.25s cubic-bezier(0, 0, 0.5, 2);
}
</style>